/**
 */
package com.dingpeikeji.quickdeer.core.modules.line.entity;

import java.util.Date;
import java.util.List;

import org.hibernate.validator.constraints.Length;

import com.dingpeikeji.quickdeer.core.common.persistence.DataEntity;
import com.dingpeikeji.quickdeer.core.modules.site.entity.TSitedtl;
import com.dingpeikeji.quickdeer.core.modules.sys.entity.Role;
import com.dingpeikeji.quickdeer.modules.rentproduct.entity.TCargotype;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.google.common.collect.Lists;

/**
 * 线路定义Entity
 * 
 * @author Zhaoy
 * @version 2016-05-12
 */
public class TLine extends DataEntity<TLine> {

	private static final long serialVersionUID = 1L;

	// 线路状态的取值
	public static final String LINESTATUS_VALID = "0"; // 有效
	public static final String LINESTATUS_UNVALID = "1"; // 无效

	public static final String LINE_TYPE_TRAVEL = "1"; // 旅游包车
	public static final String LINE_TYPE_PLANE = "2"; // 接送机包车
	public static final String LINE_TYPE_TRAIN = "3"; // 接送火车包车

	private String lineid; // lineid
	private String linetype; // 线路种类
	private Integer traveltype; // 旅游包车(周边游1,目的地游2)
	@JsonIgnore
	private String ishot; // 热门线路(热门1,非热门0)
	private String linekind; // 接送种类
	private String linename; // 线路名称
	private String linepic; // 线路图片(旅游线路)
	private TSitedtl departcity; // 出发城市
	private String sitename; // 出发站点
	private TSitedtl destcity; // 到达城市
	private TCargotype cargotype; // 车型
	private String miles; // 公里数
	private Date fromdate; // 租赁起始日期
	private Date stopdate; // 租赁结束日期
	private Integer estdays; // 预计天数
	private String estperiod; // 预计时长
	private String description; // 线路描述
	private String linestatus; // 线路状态
	private String stopsites; // 经停城市明细用逗号分割
	private Double suitrtnprice;    //线路最低价格
	private String departid;      //出发地id
	private String destid;		//目的地id
	public Double getSuitrtnprice() {
		return suitrtnprice;
	}

	public void setSuitrtnprice(Double suitrtnprice) {
		this.suitrtnprice = suitrtnprice;
	}


	public String getIshot() {
		return ishot;
	}

	public void setIshot(String ishot) {
		this.ishot = ishot;
	}

	public String getLinepic() {
		return linepic;
	}

	public void setLinepic(String linepic) {
		this.linepic = linepic;
	}

	public String getDepartid() {
		return departid;
	}

	public void setDepartid(String departid) {
		this.departid = departid;
	}

	public String getDestid() {
		return destid;
	}

	public void setDestid(String destid) {
		this.destid = destid;
	}


	private List<TSitedtl> stopcitys = Lists.newArrayList(); // 经停城市

	public TLine() {
		super();
	}

	public TLine(String id) {
		super(id);
	}

	public Integer getTraveltype() {
		return traveltype;
	}

	public String getSitename() {
		return sitename;
	}

	public void setSitename(String sitename) {
		this.sitename = sitename;
	}

	public void setTraveltype(Integer traveltype) {
		this.traveltype = traveltype;
	}

	public String getLineid() {
		return lineid;
	}


	public void setLineid(String lineid) {
		this.lineid = lineid;
	}

	@Length(min = 1, max = 50, message = "线路名称长度必须介于 1 和 50 之间")
	public String getLinename() {
		return linename;
	}

	public void setLinename(String linename) {
		this.linename = linename;
	}

	public String getMiles() {
		return miles;
	}

	public void setMiles(String miles) {
		this.miles = miles;
	}

	@Length(min = 0, max = 50, message = "预计时长长度必须介于 0 和 50 之间")
	public String getEstperiod() {
		return estperiod;
	}

	public void setEstperiod(String estperiod) {
		this.estperiod = estperiod;
	}

	@Length(min = 1, max = 1, message = "线路状态长度必须介于 1 和 1 之间")
	public String getLinestatus() {
		return linestatus;
	}

	public void setLinestatus(String linestatus) {
		this.linestatus = linestatus;
	}

	public TSitedtl getDepartcity() {
		return departcity;
	}

	public void setDepartcity(TSitedtl departcity) {
		this.departcity = departcity;
	}

	public TSitedtl getDestcity() {
		return destcity;
	}

	public void setDestcity(TSitedtl destcity) {
		this.destcity = destcity;
	}

	public TCargotype getCargotype() {
		return cargotype;
	}

	public void setCargotype(TCargotype cargotype) {
		this.cargotype = cargotype;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Date getFromdate() {
		return fromdate;
	}

	public void setFromdate(Date fromdate) {
		this.fromdate = fromdate;
	}

	public Date getStopdate() {
		return stopdate;
	}

	public void setStopdate(Date stopdate) {
		this.stopdate = stopdate;
	}

	public Integer getEstdays() {
		return estdays;
	}

	public void setEstdays(Integer estdays) {
		this.estdays = estdays;
	}

	public List<TSitedtl> getStopcitys() {
		return stopcitys;
	}

	public void setStopcitys(List<TSitedtl> stopcitys) {
		this.stopcitys = stopcitys;
	}

	@JsonIgnore
	public List<String> getSiteIdList() {
		List<String> siteIdList = Lists.newArrayList();
		for (TSitedtl site : stopcitys) {
			siteIdList.add(site.getSiteid());
		}
		return siteIdList;
	}

	public void setSiteIdList(List<String> siteIdList) {
		stopcitys = Lists.newArrayList();
		if (siteIdList != null) {
			for (String siteId : siteIdList) {
				TSitedtl site = new TSitedtl();
				site.setSiteid(siteId);
				stopcitys.add(site);
			}
		}
	}

	public String getStopsites() {
		return stopsites;
	}

	public void setStopsites(String stopsites) {
		this.stopsites = stopsites;
	}

	public String getLinetype() {
		return linetype;
	}

	public void setLinetype(String linetype) {
		this.linetype = linetype;
	}

	public String getLinekind() {
		return linekind;
	}

	public void setLinekind(String linekind) {
		this.linekind = linekind;
	}

}
